import React from 'react'
import { Calendar, Cell } from 'react-vant'

function index(day ) {
    const formatter = day => {
  const month = day.date.getMonth() + 1
  const date = day.date.getDate()

  if (month === 4) {
    if (date === 25) {
      day.bottomInfo = '今天'
    } else if (date === 26) {
      day.bottomInfo = '明天'
    } else if (date === 27) {
      day.bottomInfo = '后天'
    }
  } 
  return day
}
  return (
    <div>
         <Calendar type='range' formatter={formatter}>
        {(val, actions) => (
          <Cell
            isLink
            title='日期'
            titleStyle={{ flex: 'none' }}
            value={
              val
                ? val.map(el => el.toLocaleDateString()).join('~')
                : '请选择日期'
            }
            onClick={() => actions.open()}
          />
        )}
      </Calendar>

    </div>
  )
}

export default index